package com.glacier.cloud.user.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.glacier.framework.component.dto.response.Response;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * date 2023-12-04 10:35
 *
 * @author glacier
 * @version 1.0
 */
@Slf4j
@RefreshScope
@RestController
@RequestMapping("customer")
public class CustomerController {

    @GetMapping("/{userId}")
    public Response<String> getUserName(@PathVariable("userId") Long userId) {
        log.info("被调用了！userId = {}", userId);
        return Response.success("yh-" + userId);
    }

    @GetMapping("/hot")
    @SentinelResource(value = "hot")
    public String hot(Integer userId) {
        System.out.println("被调用了！");
        return "hot-" + userId;
    }


}
